<html>
<head><meta charset="utf-8"><title>PR #2311 · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/PR.20.232311.html">PR #2311</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="181603576"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/PR%20%232311/near/181603576" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Edwin Cheng <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/PR.20.232311.html#181603576">(Nov 22 2019 at 01:45)</a>:</h4>
<p>I am starting to debug <a href="https://github.com/rust-lang/rust/issues/2311" target="_blank" title="https://github.com/rust-lang/rust/issues/2311">#2311</a>, which I finally know the root causes of it : </p>
<ul>
<li>The current <code>Expansion::map_token_down</code> only works for <code>ident</code> and <code>keyword</code>, and parenthesis is not supported. It is due to we only store TokenId for <code>ident</code> and <code>keyword</code> in mbe.</li>
<li>Even moving the cursor to foo (i.e. <code>f&lt;|&gt;oo</code>) will not work either, because in <a href="https://github.com/rust-analyzer/rust-analyzer/blob/87cf8bb03df92418a8779da0d586b885c8480fe3/crates/ra_ide_api/src/call_info.rs#L22-L26" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/blob/87cf8bb03df92418a8779da0d586b885c8480fe3/crates/ra_ide_api/src/call_info.rs#L22-L26">here</a>, the <code>name_ref</code> syntax node (which is expanded by a macro-call) do not live in the original <code>position.file_id</code>, which is a case the current <code>SourceAnalyzer</code> did not handle.</li>
</ul>



<a name="181603582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/PR%20%232311/near/181603582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Edwin Cheng <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/PR.20.232311.html#181603582">(Nov 22 2019 at 01:45)</a>:</h4>
<p><span class="user-mention" data-user-id="203366">@Jeremy Kolb</span></p>



<a name="181616315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/PR%20%232311/near/181616315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/PR.20.232311.html#181616315">(Nov 22 2019 at 07:45)</a>:</h4>
<p><span class="user-mention" data-user-id="216201">@Edwin Cheng</span> long term, I believe we should add IDs to all tokens, and not only identifiers.</p>



<a name="181616599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/PR%20%232311/near/181616599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Edwin Cheng <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/PR.20.232311.html#181616599">(Nov 22 2019 at 07:52)</a>:</h4>
<p>How about delimiter ?</p>



<a name="181616837"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/PR%20%232311/near/181616837" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/PR.20.232311.html#181616837">(Nov 22 2019 at 07:59)</a>:</h4>
<p>Delims also should have IDs of some form, but, as they are guaranteed to be paired, the encoding would be somewhat awkward</p>



<a name="181616926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/PR%20%232311/near/181616926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/PR.20.232311.html#181616926">(Nov 22 2019 at 08:00)</a>:</h4>
<p>I think we should assign a single ID to both delims, and store the whole range in the TokenMap</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>